<form class="form-horizontal" method="post" action="{{ action }}" enctype="multipart/form-data">
    {{ form.csrf_token }}
    {% for field in form %}
        {% if field.type == "CSRFTokenField" or field.type == "HiddenField" %}
            {{ field }}
        {% else %}
            <div class="control-group {% if field.errors %}error{% endif %}">
                {{ field.label(class="control-label") }}
                <div class="controls">
                    {# hack #}
                    {% if field.short_name == 'price' %}
                        <div class="input-prepend">
                            <span class="add-on">$</span>
                            {{ field }}
                        </div>
                    {% else %}
                        {{ field }}
                    {% endif %}

                    {% if field.errors %}
                        <span class="help-inline">{{ field.errors|join(', ') }}</span>
                    {% elif field.description %}
                        <span class="help-inline">{{ field.description }}</span>
                    {% endif %}
                </div>
            </div>
        {% endif %}
    {% endfor %}
    <div class="form-actions">
        {% if crud_method == "create" %}
            <input class="btn btn-primary" type="submit" value="{{ _('Create Item') }}">
            <a class="btn" href="{{ url_for('item_index') }}">{{ _('Cancel') }}</a>
        {% elif crud_method == "update" %}
            <input class="btn btn-primary" type="submit" value="{{ _('Update Item') }}">
            <a class="btn" href="{{ url_for('item', id=id, slug=slug) }}">{{ _('Cancel') }}</a>
        {% endif %}
    </div>
</form>
